package com.eedi.framework.protocol.dal.mapper;


import com.eedi.framework.common.enums.CommonStatusEnum;
import com.eedi.framework.common.pojo.PageResult;
import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
import com.eedi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.eedi.framework.protocol.controller.sys.vo.SysProtocolHistoryPageReq;
import com.eedi.framework.protocol.dal.dataobject.ProtocolHistoryDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 协议配置历史版本 Mapper
 *
 * @author 永聚长青源码
 */
@Mapper
public interface ProtocolHistoryMapper extends BaseMapperX<ProtocolHistoryDO> {

    default PageResult<ProtocolHistoryDO> selectPage(SysProtocolHistoryPageReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProtocolHistoryDO>()
                .eqIfPresent(ProtocolHistoryDO::getSysProtocolHistoryId, reqVO.getSysProtocolId())
                .eqIfPresent(ProtocolHistoryDO::getSysProtocolPublishStatus, CommonStatusEnum.ENABLE)
                .orderByAsc(ProtocolHistoryDO::getSysProtocolSort));
    }

}
